//@ sourceURL=SceneTaskManageView.js
Ext.ns("SceneTaskManageView");

SceneTaskManageView = Ext.extend(Ext.Panel,{
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        SceneTaskManageView.superclass.constructor.call(this, {
            id : "SceneTaskManageView",
            title : "现场作业管理",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
    var yearGridComponents=new createyeargridview({
        topbar : {
            inputFormName : 'SceneTaskManageForm',
            topbarAdd:{
                hidden:false
            },
            topbarDel:{
                hidden:false
            }
        },
        search : {
            items : [ {
                style : "margin:5px 5px 5px 5px;",
                text : "项目名称"
            }, {
                columnWidth : 0.2,
                xtype : "textfield",
                name : "Q_projectName_S_LK",
                maxLength : 256
            } ]
        },
        grid : {
            title : "现场作业管理列表",
            rowActions:true,
            listUrl : __ctxPath + "/relatedparty/listSceneTaskManage.do",
            removeUrl : __ctxPath + "/relatedparty/deleteSceneTaskManage.do",
            fields : [ "id", "years", "institution","projectName","constructionSide", "safePerson", "checkAgency", "checkPerson", "participatePerson", "checkContent", "checkConclusion","relatedPartyProtocolId","protocolName"],
            columns : [ {
                header : "id",
                dataIndex : "id",
                hidden : true
            },{
                header : "年份",
                dataIndex : "years",
                width : 50,
                hidden : true,
                sortable : true
            },{
                header : "所属机构",
                dataIndex : "institution",
                hidden : true,
                width:80
            },{
                header : "所属协议",
                dataIndex : "id",
                sortable : false,
                width : 50,
                renderer : function(j, i, g, m, h) {
                    var cfg={
                            relatedPartyProtocolId : g.data.relatedPartyProtocolId
                    }
                    var k = "";
                            k += '<a href="#" onclick=\'SceneTaskManageView.ProtocolInfor('
                                + JSON.stringify(cfg) + ')\'>'+g.data.protocolName+'</a>';
                    return k;
                }
            },{
                header : "项目名称",
                dataIndex : "projectName",
                width:80
            },{
                header : "施工方",
                dataIndex : "constructionSide",
                width:70
            },{
                header : "安全责任人",
                dataIndex : "safePerson",
                width:80
            },{
                header : "检查机构",
                dataIndex : "checkAgency",
                width:80
            },{
                header : "检查负责人",
                dataIndex : "checkPerson",
                width:80
            },{
                header : "存在的问题",
                dataIndex : "id",
                sortable : false,
                width : 50,
                renderer : function(j, i, g, m, h) {
                    var cfg={
                            sceneTaskManageId : g.data.id
                    }
                    var k = "";
                            k += '<button title="评估" value="" class="btn-showDetail" onclick=\'SceneTaskManageView.problemInfor('
                                + JSON.stringify(cfg) + ')\'></button>';
                    return k;
                }
            }/*,{
                header : "参检人员",
                dataIndex : "participatePerson",
                width:80
            },{
                header : "检查内容",
                dataIndex : "checkContent",
                width:80
            },{
                header : "检查结论",
                dataIndex : "checkConclusion",
                width:80
            }*/ ]
        },
        tree : {
            treeUrl : __ctxPath + "/relatedparty/treeLoadSceneTaskManage.do"
        }
        
    });
    return yearGridComponents;
}
});
SceneTaskManageView.problemInfor = function(sceneTaskManage){
    new ExistingProblemsWindow({
        sceneTaskManageId : sceneTaskManage.sceneTaskManageId
    }).show();
};

SceneTaskManageView.ProtocolInfor = function(id){
    new RelatedPartyProtocolForm({
        id:id.relatedPartyProtocolId,
        operation: Constant.Operation.VIEW
    }).show();
};

SceneTaskManageView.edit = function(id) {
    new SceneTaskManageForm({
        id : id,
        operation: Constant.Operation.EDIT
    }).show();
};